$ninesixty-gutter-width: 20px !default

$ninesixty-grid-width: 960px !default

$ninesixty-columns: 12 !default

=grid-container
  margin-left: auto
  margin-right: auto
  width: $ninesixty-grid-width

=grid-width($n, $cols: 12, $gutter-width: 20px)
  width: $ninesixty-grid-width / $cols * $n - $gutter-width

=grid-unit-base($gutter-width: 20px)
  display: inline
  float: left
  margin:
    left: $gutter-width / 2
    right: $gutter-width / 2

=grid($n, $cols: 12, $gutter-width: 20px)
  +grid-unit-base($gutter-width)
  +grid-width($n, $cols, $gutter-width)

=alpha
  margin-left: 0

=omega
  margin-right: 0

=grids($cols: 12, $gutter-width: 20px)
  #{enumerate(".grid", 1, $cols, "_")}
    +grid-unit-base
  @for $n from 1 through $cols
    .grid_#{$n}
      +grid-width($n, $cols, $gutter-width)

=grid-prefix($n, $cols: 12)
  padding-left: $ninesixty-grid-width / $cols * $n

=grid-prefixes($cols: 12)
  @for $n from 1 through $cols - 1
    .prefix_#{$n}
      +grid-prefix($n, $cols)

=grid-suffix($n, $cols: 12)
  padding-right: $ninesixty-grid-width / $cols * $n

=grid-suffixes($cols: 12)
  @for $n from 1 through $cols - 1
    .suffix_#{$n}
      +grid-suffix($n, $cols)

=grid-children
  .alpha
    +alpha
  .omega
    +omega

=grid-move-base
  position: relative

=grid-push($n, $cols)
  left: ($ninesixty-grid-width / $cols) * $n

=grid-pull($n, $cols)
  left: -($ninesixty-grid-width / $cols) * $n

=grid-movements($cols: 12)
  #{enumerate(".push", 1, $cols, "_")},
  #{enumerate(".pull", 1, $cols, "_")}
    +grid-move-base
  @for $n from 1 through $cols
    .push_#{$n}
      +grid-push($n, $cols)
    .pull_#{$n}
      +grid-pull($n, $cols)

=grid-system($cols: 12)
  +grid-container
  +grids($cols)
  +grid-prefixes($cols)
  +grid-suffixes($cols)
  +grid-children
  +grid-movements($cols)
